import Vue from 'vue'
import Router from 'vue-router'
//指定默认访问页面
import Home from "../views/Home/Home.vue"
const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect:"/home/index",
    component:()=>import("../views/Home/Home.vue"),
    children:[
      {
        path:"/home/index",
        component:()=>import("../views/Index/Index.vue"),
        children:[
          // {
          //   path:"/home/index/article",
          //   component:()=>import("../views/Index/Component/Article.vue")
          // },
        ]
      },
      {
        path:"/home/classify",
        component:()=>import("../views/Classify/Classify.vue")
      },
      {
        path:"/home/shopCar",
        component:()=>import("../views/ShopCar/ShopCar.vue")
      },
      {
        path:"/home/mine",
        component:()=>import("../views/Mine/Mine.vue")
      },
    ]
  },
  {
    path:"/home/index/article",
    component:()=>import("../views/Index/Component/Article.vue")
  },
  {
    path:"/search",
    component:()=>import("../views/Index/Component/Search.vue")
  },
  {
    path: '/userLogin',
    name: 'Login',
    component:()=>import("../views/Login/Login.vue")
  },
  {
    path: '/userRegister',
    name: 'Register',
    component:()=>import("../views/Login/Register.vue")
  },
  {
    path: '/addressManage',
    name: 'Address',
    component:()=>import("../views/Mine/MyAddress.vue")
  },
  {
    path: '/addNewAddress',
    name: 'Address',
    component:()=>import("../views/Mine/Component/AddNewAddress.vue")
  },
  {
    path: '/myOrder',
    name: 'MyOrder',
    component:()=>import("../views/ShopCar/MyOrder.vue")
  },
  {
    path: '/goodsItemDetails',
    name: 'GoodsDetails',
    component:()=>import("../views/Classify/GoodsDetails.vue")
  },
  {
    path: '/settlePage',
    name: 'SettlePage',
    component:()=>import("../views/ShopCar/SettlePage.vue")
  }
]

const router = new Router({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
